package classpath

import (
	"io/ioutil"
	"path/filepath"
)

/**
	文件夹获取class实现
 */
type DirEntry struct {
	absDir string
}

/**
	构造文件夹获取class实现
 */
func newDirEntry(path string) *DirEntry {
	absDir, err := filepath.Abs(path)
	if err != nil {
		panic(err)
	}
	return &DirEntry{absDir}
}

/**
	读取文件夹内的class
 */
func (self *DirEntry) readClass(className string) ([]byte, Entry, error) {
	fileName := filepath.Join(self.absDir, className)
	data, err := ioutil.ReadFile(fileName)
	return data, self, err
}

/**
	获取当前文件夹目录
 */
func (self *DirEntry) String() string {
	return self.absDir
}

